package com.example.ch08;

import com.example.ch08.Entity.User;
import com.example.ch08.Service.UserService;
import com.example.ch08.util.RedisUtil;
import org.junit.Before;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
import redis.clients.jedis.Jedis;
import sun.dc.pr.PRError;

import java.util.List;

@SpringBootTest
public class JedisTester {
    private UserService userService;
    private Jedis jedis;

    @Before
    public void before(){
        jedis = new Jedis("127.0.0.1", 6379);
//        jedis.auth("foobared");
    }

    @Test
    public void test01(){
//        jedis.set("naem","dfsfsd");
//        jedis.expire("naem",60);
        String value = jedis.get("naem");  //取出key为uname的值
        System.out.println("anme的值为："+ value);
        System.out.println( jedis.ttl("naem"));


    }

    @Test
    public void test(){
        System.out.println(RedisUtil.get("name"));
    }


}
